//
//  PlayLayer.h
//  MinusTheBox
//
//  Created by Chi Ho Chiu on 15/4/12.
//  Copyright 2012 Individual. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "cocos2d.h"

#import "Box2DArray.h"
#import "GameConstant.h"
#import "GameManager.h"

@protocol PlayLayerDelegate;

typedef enum
{
	kTAG_STEP_LABEL = 1,
	kTAG_BACK_STEP_MENU_ITEM = 2,
	kTAG_LEFT_MENU = 3,
	KTAG_HINT_MENU_ITEM = 4,
	kTAG_RIGHT_MENU = 5
} EPlayLayerTag;

@interface PlayLayer : CCLayer {
	ESpritesState spritesState;
	Box2DArray *spritesArray;
	
	id<PlayLayerDelegate> delegate;
	int runningSprite;	
}
@property (nonatomic, retain) Box2DArray *spritesArray;
@property (nonatomic, assign) ESpritesState spritesState;
@property (nonatomic, assign) id<PlayLayerDelegate> delegate;
@property (nonatomic, assign) int runningSprite;

#pragma mark - init
-(id) initWithMaxStep:(int)val withDelegate:(id<PlayLayerDelegate>)layerDelegate;
-(void) placeBox:(Box2DArray *)boxArray;
-(void) removeAllBox;

#pragma mark - Box interation
-(void) updateBoxNumberFrom:(int)oriVal to:(int)newVal inColumn:(int)col inRow:(int)row;
-(void) fallBoxInColumn:(int)oriCol fromRow:(int)oriRow toRow:(int)newRow;
-(void) chainBoxInColumn:(int)col row:(int)row;
-(void) explodeZeroBoxInColumn:(int)col row:(int)row;

#pragma mark - Other UI interaction
-(void) showBackToPreviousStepSprite:(BOOL)bIsShow;
-(void) updateCurrentStep:(int)curStep maxStep:(int)maxStep;
-(void) setEnableTouch:(BOOL)isEnable;
-(void) showHintBtn:(BOOL)show;

#pragma mark - CCAction
-(void) onActionCompleted:(CCSprite *)sender;

/*
-(void) removeBoxFromLayer:(CCSprite *)sender data:(NSArray *)pos;	//Explode Zero
-(void) changeSpriteNumber:(CCSprite *)sender data:(NSNumber *)valObj;	//Minus Number
*/

@end






@protocol PlayLayerDelegate
-(void) onSelectedBackToPreviousStep:(id)sender;
-(void) onSelectedHint:(id)sender;
-(void) onSelectedBack:(id)sender;
-(void) onSelectedRetry:(id)sender;
-(void) onSelectedNextLevel:(id)sender;

-(void) onClickedBoxInColumn:(int)col row:(int)row;
-(void) onFallBoxCompleted;
-(void) onChainBoxCompleted;
-(void) onExplodeZeroBoxCompleted;
-(void) onUpdatedBoxNumberCompleted;
@end

